Skip to main content

@interopio/browser

4.4.0

io.Connect Browser allows web apps to integrate with other apps that are part of the same io.Connect Browser project via a set of APIs. io.Connect Browser enables you to share data between apps, expose functionality, manage windows, notifications, and more.

Referencing

The @interopio/browser library is available both as a single JavaScript file, which you can include in your web apps using a <script> tag, and also as a module, which you can import in your apps:

<script type="text/javascript" src="browser.umd.js"></script>

Or:

import IOBrowser from "@interopio/browser";

Initialization

The @interopio/browser library attaches the IOBrowser() factory function to the global window object. Invoke this function to initialize the library and connect to the io.Connect Browser environment. The IOBrowser() factory function accepts an optional Config object as an argument, which you can use to provide settings for the library (e.g., initialize additional io.Connect libraries, configure the library behavior or some of its APIs). The factory function resolves with the initialized io.Connect API object, which you can use to access all available io.Connect APIs:

import IOBrowser from "@interopio/browser";
import IOWorkspaces from "@interopio/workspaces-api";

const initializeIOConnect = async () => {
    // Initializing the Workspaces API.
    const initOptions = {
        libraries: [IOWorkspaces],
    };

    // Use the initialized API object to access the io.Connect APIs.
    const io = await IOBrowser(initOptions);

    // Here, the library is already initialized and you can access all available io.Connect APIs.
    const myWorkspace = await io.workspaces.restoreWorkspace("My Workspace");
};

initializeIOConnect().catch(console.error);